package com.zaoniao.enstudy.infracore.enums;

import com.zaoniao.enstudy.api.vo.GradeVo;
import lombok.Getter;

import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 年级枚举类.
 *
 * @author llb
 */
@Getter
public enum GradeEnums {
    /**
     * 年级
     */
    Grade_1("1", "美国一年级", 1),
    Grade_2("2", "美国二年级", 1),
    Grade_3("3", "美国三年级", 1),
    Grade_4("4", "美国四年级", 1),
    Grade_5("5", "美国五年级", 1),
    Grade_6_8("6-8", "美国6~8年级", 0),
    Grade_9_12("9-12", "美国9~12年级", 1);

    public final String code;

    public final String value;
    public final Integer vip;

    GradeEnums(String code, String value, Integer vip) {
        this.code = code;
        this.value = value;
        this.vip = vip;
    }

    /**
     * 将枚举转换成为map
     */
    public static Map<String, Object> getAllGradeValues() {
        Map<String, Object> map = new LinkedHashMap<>();
        for (GradeEnums gradeEnum : EnumSet.allOf(GradeEnums.class)) {
            GradeVo vo  = new GradeVo();
            vo.setCode(gradeEnum.code);
            vo.setValue(gradeEnum.value);
            vo.setVip(gradeEnum.vip);
            map.put(gradeEnum.code, vo);
        }
        return map;
    }

}
